This is the documentation for the Realbasic Plugins from Monkeybreadsoftware.de. You find these plugins and the newest version of this document at http://www.monkeybreadsoftware.de/realbasic inside the plugins section.
This help was last updated on Freitag, 6. September 2002 and covers 2136 items: 126 classes, 2 controls and 583 global functions.
The list of the themes | Global methods by category | Global methods by name | The list of the classes | The list of the controls |
class Collection | ||||
class, Collection | So, 28. Apr 2002 | |||
Mac OS Classic: Works. | Mac OS Carbon: Works. | Windows: Works. | ||
Function:
This Plugin extends the functionality of the RB-internal class Collection. | ||||
Notes:
It'll let you inquire the key strings from a collection. That is helpful when you need to save, copy or re-create a collection from another instance, without having the explicit knowledge on the keys used in it. Note about compatibility: The way this plugin accesses the Key array of a Collection objects was implemented by reverse-engineering RB's runtime memory structures. It is possible that future RB versions implement certains internal parts differently and that those changes break the functionality of this plugin. But don't be afraid - as long as you create apps using RB and those apps work with this plugin, you're fine. Once RB changes so that it breaks the plugin, it only means that you cannot use this plugin any more to create new applications with those RB versions. You can still use older RB versions, and the apps you once created using this plugin will still work in the future. Besides, the fact that RB does not provide a "Key" method by itself, is a bad thing anyways, and I'd expect that RB adds this method internally (it would be quite simple for them) before they consider changing their runtime structures). | ||||
Exists(name as String) as Boolean | ||||
method, Collection | So, 28. Apr 2002 | |||
Mac OS Classic: Works. | Mac OS Carbon: Works. | Windows: Works. | ||
Function:
Returns true if the item named name exists. | ||||
Key(index as Integer) as String | ||||
method, Collection | So, 28. Apr 2002 | |||
Mac OS Classic: Works. | Mac OS Carbon: Works. | Windows: Works. | ||
Function:
Returns the name of the key with the index. | ||||
Example:
Consider a collection that has the pairs (key: "height", value: "1.9") and (key: "width", value: "5.5"): dim c as Collection c = new Collection c.Add 1.9, "height" c.Add 5.5, "width" With RB's provided methods, you can now iterate over the values, like this: for i = 1 to c.Count MsgBox "Value #" + str(i) + " is " + c.Item(i) next This will output: Value #1 is 1.9 Value #2 is 5.5 But how do you get a list of the keys? RB does not provide for this. This plugin does: for i = 1 to c.Count MsgBox "Key #" + str(i) + " is " + c.Key(i) next This will output: Key #1 is height Key #2 is width | ||||
Notes:
Returns a copy of the string that represents the key at a certain index (index is 1-based). If the index is out of bounds, an empty string is returned. That fact that it returns a copy means that you cannot modify the original key string once it has been added to the Collection (you can always remove a entry, and add it again with a different key name, of course). |
Written 2002 by Christian Schmitz. Feel free to ask or report mistakes to realbasic@macsw.de.
Thanks.